from selenium import webdriver
import time

url = 'https://qzone.qq.com'
bro = webdriver.Chrome(executable_path='web_pa\chromedriver.exe')
bro.get(url)

# 定位到iframe标签
bro.switch_to.frame('login_frame')

# 点击切换为账号密码登陆
span = bro.find_element_by_id('switcher_plogin')
span.click()

# 定位输入框输入账号密码
user_name = bro.find_element_by_id('u')
user_pwd = bro.find_element_by_id('p')
user_name.send_keys('10000000')
user_pwd.send_keys('12345678')

# 点击登陆按钮
login_btn = bro.find_element_by_id('login_button')
login_btn.click()

time.sleep(1)
bro.quit()